use crate::models::Navs;
use fluffy::{db, model::Model};

lazy_static! {
    pub static ref NAVS: Vec<Navs> =  { 
        let mut conn = db::get_conn();
        let mut navs = vec![];
        
        let query = query![
            fields => "id, name, url, is_blank",
            order_by => "seq DESC",
        ];
        let rows = Navs::fetch_rows(&mut conn, &query, None);
        for r in rows { 
            let (id, name, url, is_blank): (usize, String, String, u32) = from_row!(r);
            navs.push(Navs { id, name, url, is_blank});
        }

        navs
    };
}
